package com.zz.tijian.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @TableName topic
 */
@TableName(value ="topic")
@Data
@ApiModel(description = "主题信息")
public class Topic implements Serializable {
    /**
     * id
     */
    @TableId(type = IdType.AUTO)
    @Id
    @ApiModelProperty(value = "主题ID", example = "1")
    private Integer id;

    @Field(type = FieldType.Text, copyTo = "all")
    @ApiModelProperty(value = "主题标题")
    private String title;

    @Field(type = FieldType.Text, copyTo = "all")
    @ApiModelProperty(value = "主题内容")
    private String content;

    @Field(type = FieldType.Keyword, index = false)
    @ApiModelProperty(value = "用户ID")
    private String userId;

    @Field(type = FieldType.Text, index = false)
    @ApiModelProperty(value = "真实姓名")
    private String realName;

    @Field(type = FieldType.Date, format = DateFormat.custom, pattern = "yyyy-MM-dd HH:mm:ss", index = false)
    @ApiModelProperty(value = "创建时间")
    private LocalDateTime createdTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
}
